package ch.fhnw.qualiscan.api.output;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import ch.fhnw.qualiscan.core.db.pojos.Survey;

@XmlRootElement
public class SurveysOutput {
	
	List<Survey> surveys;
	List<SurveyOutput> surveyOutput;

	public SurveysOutput() {}
	
	public SurveysOutput(List<Survey> surveys) {
		this.surveys = surveys;
	}
	
	@XmlElementWrapper(name="surveys")
    public List<SurveyOutput> getSurvey() {
        if(surveyOutput == null) {
        	surveyOutput = new ArrayList<SurveyOutput>();
        }
        
        if (surveys != null) {
            for (Survey survey : surveys) {
            	surveyOutput.add(new SurveyOutput(survey));
            }
        }

        return surveyOutput;
    }
	
}
